package cn.gson.springboot.model.dao;

import java.util.List;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

import com.alibaba.fastjson.JSONArray;

import cn.gson.springboot.model.pojos.Section;
import cn.gson.springboot.model.pojos.User;

public interface UserDao extends CrudRepository<User, Integer>{
	@Query("select userId from User u ")
	public List<Integer> findId();
	
	@Query("select u from User u where u.userName=?1 and u.userPwd=?2 and u.userState='在职'")
	public User cxyh(String userName,String userPwd);

	@Query("select s from Section s")
	public List<Section> kscx();
	
	
	@Query("select u from User u join u.roles r join r.functions fs where u.userName=?1 and u.userPwd=?2 and u.userState='在职' and fs.functionId=52")
	public User cxyh2(String userName,String userPwd);
}
